home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_02_08
/
2n08062a
< prev
next >
Wrap
Text File
|
1991-05-12
|
524b
|
23 lines
CREATE TEMPORARY TABLE Temp
(region# INTEGER NOT NULL,
appcount INTEGER NOT NULL,
fundcount INTEGER NOT NULL);
INSERT INTO Temp (region#, appcount, fundcount)
SELECT region#, COUNT(appdate), 0
FROM Loans
WHERE appdate BETWEEN 1991-Apr-01 AND 1991-Apr-30
GROUP BY region#
UNION ALL
SELECT region#, 0, COUNT(funddate)
FROM Loans
WHERE funddate BETWEEN 1991-Apr-01 AND 1991-Apr-30
GROUP BY region#
ORDER BY 1;
SELECT region#, SUM(appcount), SUM(fundcount)
FROM Temp
GROUP BY region#;